
#include <cppunit/config/SourcePrefix.h>

#include "TestPKBGetByEntityFunc.h"
#include "PKB.h"
#include "Type.h"
#include "DesignEntityType.h"
#include <iostream>
#include <string>

void PKBGetByEntityFuncTest::setUp(){
}

void PKBGetByEntityFuncTest::tearDown(){
}

/*
procedure Foo{
(01)	if x {                     
(02)		x = 0;
(03)		while y{
(04)			x = 0;
(05)			y = 0;
(06)			if y {
(07)				x = 0;
				}
(08)			z = 0;
			}
(09)		while z{
(10)			z = 0;
			}
(11)		y = 0;
(12)		if z {
(13)			while x {
(14)				if y {
(15)					z = 0;
					}
				}
(16)			y = 0;
			}
(17)		z = 0;
		}
(18)	call Bar;
}
*/



void PKBGetByEntityFuncTest::testGetFollowStarWithLineEntity(){
	std::cout<<std::endl<<"PKB Relationship FollowStarwithlineEntity() - Entering ..."<<std::endl;
	PKB::initializeInstance();
	PKB* pkbR = PKB::getInstance();
	//Set follow relationship
	std::cout<<std::endl<<"Setting follow relation starts ..."<<std::endl;
	pkbR->setFollows(1,18);
	
	pkbR->setFollows(2,3);
	pkbR->setFollows(3,9);
	pkbR->setFollows(9,11);
	pkbR->setFollows(11,12);
	pkbR->setFollows(12,17);

	pkbR->setFollows(4,5);
	pkbR->setFollows(5,6);
	pkbR->setFollows(6,8);
	
	pkbR->setFollows(13,16);
	std::cout<<std::endl<<"Setting follow relation ends ..."<<std::endl;
	//Set EntityTable
	std::cout<<std::endl<<"Setting lineEntity starts ..."<<std::endl;
	pkbR->insertLineEntity(1,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(6,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(12,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(14,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(3,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(9,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(13,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(18,Type::Entity::CALL_LINE_ENTITY);
	std::cout<<std::endl<<"Setting lineEntity ends ..."<<std::endl;
	//Test IF for statement 3
	std::cout<<std::endl<<"testing If for statement3 ..."<<std::endl;
	Type::Index::Line followsStarThreeIfSamplec[] = {12};
	Type::List::Line followsStarThreeIfSample (followsStarThreeIfSamplec, followsStarThreeIfSamplec + sizeof(followsStarThreeIfSamplec)/sizeof(Type::Index::Line));
	Type::List::Line followsStarThreeIf = pkbR->getFollowStar(3,Type::Entity::IF_LINE_ENTITY);
	for(int k=0;k<followsStarThreeIf.size();k++){
			std::cout<<followsStarThreeIf.at(k)<<", ";
		}std::cout<<std::endl;
	for(int k=0;k<followsStarThreeIfSample.size();k++){
			std::cout<<followsStarThreeIfSample.at(k)<<", ";
		}std::cout<<std::endl;
	CPPUNIT_ASSERT(followsStarThreeIfSample == followsStarThreeIf);
	std::cout<<std::endl<<"testing If for statement3 ends..."<<std::endl;

	//Test WHILE for statement 3
	Type::Index::Line followsStarThreeWHILESamplec[] = {9};
	Type::List::Line followsStarThreeWHILESample (followsStarThreeWHILESamplec, followsStarThreeWHILESamplec + sizeof(followsStarThreeWHILESamplec)/sizeof(Type::Index::Line));
	Type::List::Line followsStarThreeWHILE = pkbR->getFollowStar(3,Type::Entity::WHILE_LINE_ENTITY);

	CPPUNIT_ASSERT(followsStarThreeWHILESample == followsStarThreeWHILE);

	//Test CALL for statement 3
	Type::List::Line followsStarThreeCALLSample;
	Type::List::Line followsStarThreeCALL = pkbR->getFollowStar(3,Type::Entity::CALL_LINE_ENTITY);
	CPPUNIT_ASSERT(followsStarThreeCALLSample == followsStarThreeCALL);
	std::cout<<"Destroying ... "<<std::endl;
	pkbR->~PKB();
	std::cout<<"Destroyed ... "<<std::endl;
}
void PKBGetByEntityFuncTest::testGetFollowedByStarWithLineEntity(){
	std::cout<<std::endl<<"PKB Relationship getFollowedByStarWithLineEntity() - Entering ..."<<std::endl;
	PKB::initializeInstance();
	PKB* pkbR = PKB::getInstance();
	//Set follow relationship
	std::cout<<std::endl<<"Setting follow relation starts ..."<<std::endl;
	pkbR->setFollows(1,18);
	
	pkbR->setFollows(2,3);
	pkbR->setFollows(3,9);
	pkbR->setFollows(9,11);
	pkbR->setFollows(11,12);
	pkbR->setFollows(12,17);

	pkbR->setFollows(4,5);
	pkbR->setFollows(5,6);
	pkbR->setFollows(6,8);
	
	pkbR->setFollows(13,16);
	std::cout<<std::endl<<"Setting follow relation ends ..."<<std::endl;
	//Set EntityTabel
	std::cout<<std::endl<<"Setting lineEntity starts ..."<<std::endl;
	pkbR->insertLineEntity(1,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(6,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(12,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(14,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(3,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(9,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(13,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(18,Type::Entity::CALL_LINE_ENTITY);
	std::cout<<std::endl<<"Setting lineEntity ends ..."<<std::endl;
	//Test IF for statement 12
	Type::List::Line FollowedByStarTwelveIfSample;
	Type::List::Line FollowedByStarTwelveIf = pkbR->getFollowedByStar(12,Type::Entity::IF_LINE_ENTITY);
	CPPUNIT_ASSERT(FollowedByStarTwelveIfSample == FollowedByStarTwelveIf);

	//Test WHILE for statement 12
	Type::Index::Line FollowedByStarTwelveWHILESamplec[] = {3,9};
	Type::List::Line FollowedByStarTwelveWHILESample (FollowedByStarTwelveWHILESamplec, FollowedByStarTwelveWHILESamplec + sizeof(FollowedByStarTwelveWHILESamplec)/sizeof(Type::Index::Line));
	Type::List::Line FollowedByStarTwelveWHILE = pkbR->getFollowedByStar(12,Type::Entity::WHILE_LINE_ENTITY);
	std::sort(FollowedByStarTwelveWHILE.begin(),FollowedByStarTwelveWHILE.end());
	CPPUNIT_ASSERT(FollowedByStarTwelveWHILESample == FollowedByStarTwelveWHILE);

	//Test CALL for statement 12
	Type::List::Line FollowedByStarTwelveCALLSample;
	Type::List::Line FollowedByStarTwelveCALL = pkbR->getFollowedByStar(12,Type::Entity::CALL_LINE_ENTITY);
	CPPUNIT_ASSERT(FollowedByStarTwelveCALLSample == FollowedByStarTwelveCALL);
	std::cout<<"Destroying ... "<<std::endl;
	pkbR->~PKB();
	std::cout<<"Destroyed ... "<<std::endl;
}
void PKBGetByEntityFuncTest::testGetChildWithLineEntity(){
	std::cout<<std::endl<<"PKB Relationship getChildStarWithLineEntity - Entering ..."<<std::endl;
	PKB::initializeInstance();
	PKB* pkbR = PKB::getInstance();
	//pkbR->~PKB();
	//set parent relation
	std::cout<<std::endl<<"Setting parent relation starts ..."<<std::endl;
	pkbR->setParent(1,2);
	pkbR->setParent(1,3);
	pkbR->setParent(1,9);
	pkbR->setParent(1,11);
	pkbR->setParent(1,12);
	pkbR->setParent(1,17);
	pkbR->setParent(3,4);
	pkbR->setParent(3,5);
	pkbR->setParent(3,6);
	pkbR->setParent(3,8);
	pkbR->setParent(9,10);
	pkbR->setParent(12,13);
	pkbR->setParent(12,16);
	pkbR->setParent(6,7);
	pkbR->setParent(13,14);
	pkbR->setParent(14,15);
	std::cout<<std::endl<<"Setting parent relation ends ..."<<std::endl;
	//Set EntityTabel
	std::cout<<std::endl<<"Setting lineEntity starts ..."<<std::endl;
	pkbR->insertLineEntity(1,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(6,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(12,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(14,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(3,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(9,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(13,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(18,Type::Entity::CALL_LINE_ENTITY);
	std::cout<<std::endl<<"Setting lineEntity ends ..."<<std::endl;
	
	//test getChildWithLineEntity While
	std::cout<<std::endl<<"Setting While Sample ..."<<std::endl;
	Type::Index::Line mychildWHILE[] = {3,9};
	Type::List::Line childWHILEOfOneSample(&mychildWHILE[0],&mychildWHILE[0]+2);
	std::cout<<std::endl<<"Setting Sample ends..."<<std::endl;

	Type::List::Line childWHILEOfOne = pkbR->getChild(1,Type::Entity::WHILE_LINE_ENTITY);
	std::sort(childWHILEOfOne.begin(),childWHILEOfOne.end());
	std::cout<<"childWHILEOfOne "<<std::endl;
	for(int k=0;k<childWHILEOfOne.size();k++){
			std::cout<<childWHILEOfOne.at(k)<<", ";
	}std::cout<<std::endl;
	std::cout<<"childWHILEOfOneSample "<<std::endl;
	for(int k=0;k<childWHILEOfOneSample.size();k++){
			std::cout<<childWHILEOfOneSample.at(k)<<", ";
	}std::cout<<std::endl;
	std::cout<<"Comparing ... "<<std::endl;
	CPPUNIT_ASSERT(childWHILEOfOne == childWHILEOfOneSample); 

	std::cout<<"Destroying ... "<<std::endl;
	pkbR->~PKB();
	std::cout<<"Destroyed ... "<<std::endl;
}
void PKBGetByEntityFuncTest::testHasParentWithLineEntity(){
	std::cout<<std::endl<<"PKB Relationship hasParentWithLineEntity - Entering ..."<<std::endl;
	PKB::initializeInstance();
	PKB* pkbR = PKB::getInstance();
	//pkbR->~PKB();
	//set parent relation
	std::cout<<std::endl<<"Setting parent relation starts ..."<<std::endl;
	pkbR->setParent(1,2);
	pkbR->setParent(1,3);
	pkbR->setParent(1,9);
	pkbR->setParent(1,11);
	pkbR->setParent(1,12);
	pkbR->setParent(1,17);
	pkbR->setParent(3,4);
	pkbR->setParent(3,5);
	pkbR->setParent(3,6);
	pkbR->setParent(3,8);
	pkbR->setParent(9,10);
	pkbR->setParent(12,13);
	pkbR->setParent(12,16);
	pkbR->setParent(6,7);
	pkbR->setParent(13,14);
	pkbR->setParent(14,15);
	std::cout<<std::endl<<"Setting parent relation ends ..."<<std::endl;
	//Set EntityTabel
	std::cout<<std::endl<<"Setting lineEntity starts ..."<<std::endl;
	pkbR->insertLineEntity(1,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(6,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(12,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(14,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(3,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(9,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(13,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(18,Type::Entity::CALL_LINE_ENTITY);
	std::cout<<std::endl<<"Setting lineEntity ends ..."<<std::endl;
	
	//test has Parent with entity
	CPPUNIT_ASSERT(pkbR->hasParent(2,Type::Entity::IF_LINE_ENTITY)==true); 
	CPPUNIT_ASSERT(pkbR->hasParent(2,Type::Entity::WHILE_LINE_ENTITY)==false);
	CPPUNIT_ASSERT(pkbR->hasParent(4,Type::Entity::WHILE_LINE_ENTITY)==true); 
	CPPUNIT_ASSERT(pkbR->hasParent(4,Type::Entity::IF_LINE_ENTITY)==false);

	std::cout<<"Destroying ... "<<std::endl;
	pkbR->~PKB();
	std::cout<<"Destroyed ... "<<std::endl;
}
void PKBGetByEntityFuncTest::testHasChildWithLineEntity(){
	std::cout<<std::endl<<"PKB Relationship hasChildWithLineEntity - Entering ..."<<std::endl;
	PKB::initializeInstance();
	PKB* pkbR = PKB::getInstance();
	//set parent relation
	std::cout<<std::endl<<"Setting parent relation starts ..."<<std::endl;
	pkbR->setParent(1,2);
	pkbR->setParent(1,3);
	pkbR->setParent(1,9);
	pkbR->setParent(1,11);
	pkbR->setParent(1,12);
	pkbR->setParent(1,17);
	pkbR->setParent(3,4);
	pkbR->setParent(3,5);
	pkbR->setParent(3,6);
	pkbR->setParent(3,8);
	pkbR->setParent(9,10);
	pkbR->setParent(12,13);
	pkbR->setParent(12,16);
	pkbR->setParent(6,7);
	pkbR->setParent(13,14);
	pkbR->setParent(14,15);
	std::cout<<std::endl<<"Setting parent relation ends ..."<<std::endl;
	//Set EntityTabel
	std::cout<<std::endl<<"Setting lineEntity starts ..."<<std::endl;
	pkbR->insertLineEntity(1,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(6,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(12,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(14,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(3,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(9,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(13,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(18,Type::Entity::CALL_LINE_ENTITY);
	std::cout<<std::endl<<"Setting lineEntity ends ..."<<std::endl;
	
	//test has Parent with entity
	CPPUNIT_ASSERT(pkbR->hasChild(1,Type::Entity::IF_LINE_ENTITY)==true); 
	CPPUNIT_ASSERT(pkbR->hasChild(1,Type::Entity::WHILE_LINE_ENTITY)==true);
	CPPUNIT_ASSERT(pkbR->hasChild(2,Type::Entity::WHILE_LINE_ENTITY)==false);
	CPPUNIT_ASSERT(pkbR->hasChild(3,Type::Entity::IF_LINE_ENTITY)==true); 
	CPPUNIT_ASSERT(pkbR->hasChild(3,Type::Entity::WHILE_LINE_ENTITY)==false);

	std::cout<<"Destroying ... "<<std::endl;
	pkbR->~PKB();
	std::cout<<"Destroyed ... "<<std::endl;
}
void PKBGetByEntityFuncTest::testGetParentStarWithLineEntity(){
	std::cout<<std::endl<<"PKB Relationship getParentStarWithLineEntity - Entering ..."<<std::endl;
	PKB::initializeInstance();
	PKB* pkbR = PKB::getInstance();
	//set parent relation
	std::cout<<std::endl<<"Setting parent relation starts ..."<<std::endl;
	pkbR->setParent(1,2);
	pkbR->setParent(1,3);
	pkbR->setParent(1,9);
	pkbR->setParent(1,11);
	pkbR->setParent(1,12);
	pkbR->setParent(1,17);
	pkbR->setParent(3,4);
	pkbR->setParent(3,5);
	pkbR->setParent(3,6);
	pkbR->setParent(3,8);
	pkbR->setParent(9,10);
	pkbR->setParent(12,13);
	pkbR->setParent(12,16);
	pkbR->setParent(6,7);
	pkbR->setParent(13,14);
	pkbR->setParent(14,15);
	std::cout<<std::endl<<"Setting parent relation ends ..."<<std::endl;

	//Set EntityTabel
	std::cout<<std::endl<<"Setting lineEntity starts ..."<<std::endl;
	pkbR->insertLineEntity(1,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(6,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(12,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(14,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(3,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(9,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(13,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(18,Type::Entity::CALL_LINE_ENTITY);
	std::cout<<std::endl<<"Setting lineEntity ends ..."<<std::endl;

	//get parentStar for statement 15 (FIF) WHILE
	std::cout<<std::endl<<"Setting Sample ..."<<std::endl;
	Type::Index::Line myparentstarWHILE[] = {13};
	Type::List::Line parentStarWHILEOfFIFSample(&myparentstarWHILE[0],&myparentstarWHILE[0]+1);
	std::cout<<std::endl<<"Setting Sample ends..."<<std::endl;

	Type::List::Line parentStarWHILEOfFIF = pkbR->getParentStar(15,Type::Entity::WHILE_LINE_ENTITY);
	std::sort(parentStarWHILEOfFIF.begin(),parentStarWHILEOfFIF.end());
	std::cout<<"parentStarWHILEOfFIF "<<std::endl;
	for(int k=0;k<parentStarWHILEOfFIF.size();k++){
			std::cout<<parentStarWHILEOfFIF.at(k)<<", ";
		}std::cout<<std::endl;
	std::cout<<"parentStarWHILEOfFIFSample "<<std::endl;
	for(int k=0;k<parentStarWHILEOfFIFSample.size();k++){
			std::cout<<parentStarWHILEOfFIFSample.at(k)<<", ";
		}std::cout<<std::endl;
	std::cout<<"Comparing ... "<<std::endl;
	CPPUNIT_ASSERT(parentStarWHILEOfFIF == parentStarWHILEOfFIFSample); //Match line 1 's WHILE parent and grandparent

	//get parentStar for statement 15 (FIF) IF
	std::cout<<std::endl<<"Setting Sample ..."<<std::endl;
	Type::Index::Line myparentstarIF[] = {1,12,14};
	Type::List::Line parentStarIFOfFIFSample(&myparentstarIF[0],&myparentstarIF[0]+3);
	std::cout<<std::endl<<"Setting Sample ends..."<<std::endl;

	Type::List::Line parentStarIFOfFIF = pkbR->getParentStar(15,Type::Entity::IF_LINE_ENTITY);
	std::sort(parentStarIFOfFIF.begin(),parentStarIFOfFIF.end());
	std::cout<<"parentStarIFOfFIF "<<std::endl;
	for(int k=0;k<parentStarIFOfFIF.size();k++){
			std::cout<<parentStarIFOfFIF.at(k)<<", ";
		}std::cout<<std::endl;
	std::cout<<"parentStarIFOfFIFSample "<<std::endl;
	for(int k=0;k<parentStarIFOfFIFSample.size();k++){
			std::cout<<parentStarIFOfFIFSample.at(k)<<", ";
		}std::cout<<std::endl;
	std::cout<<"Comparing ... "<<std::endl;
	CPPUNIT_ASSERT(parentStarIFOfFIF == parentStarIFOfFIFSample); //Match line 1 's IF parent and grandparent


	std::cout<<"Destroying ... "<<std::endl;
	pkbR->~PKB();
	std::cout<<"Destroyed ... "<<std::endl;
}
void PKBGetByEntityFuncTest::testGetChildStarWithLineEntity(){
	std::cout<<std::endl<<"PKB Relationship getChildStarWithLineEntity - Entering ..."<<std::endl;
	PKB::initializeInstance();
	PKB* pkbR = PKB::getInstance();
	//pkbR->~PKB();
	//set parent relation
	std::cout<<std::endl<<"Setting parent relation starts ..."<<std::endl;
	pkbR->setParent(1,2);
	pkbR->setParent(1,3);
	pkbR->setParent(1,9);
	pkbR->setParent(1,11);
	pkbR->setParent(1,12);
	pkbR->setParent(1,17);
	pkbR->setParent(3,4);
	pkbR->setParent(3,5);
	pkbR->setParent(3,6);
	pkbR->setParent(3,8);
	pkbR->setParent(9,10);
	pkbR->setParent(12,13);
	pkbR->setParent(12,16);
	pkbR->setParent(6,7);
	pkbR->setParent(13,14);
	pkbR->setParent(14,15);
	std::cout<<std::endl<<"Setting parent relation ends ..."<<std::endl;

	//Set EntityTabel
	std::cout<<std::endl<<"Setting lineEntity starts ..."<<std::endl;
	pkbR->insertLineEntity(1,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(6,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(12,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(14,Type::Entity::IF_LINE_ENTITY);
	pkbR->insertLineEntity(3,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(9,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(13,Type::Entity::WHILE_LINE_ENTITY);
	pkbR->insertLineEntity(18,Type::Entity::CALL_LINE_ENTITY);
	std::cout<<std::endl<<"Setting lineEntity ends ..."<<std::endl;

	//get ChildStar for statement One WHILE
	std::cout<<std::endl<<"Setting Sample ..."<<std::endl;
	Type::Index::Line mychildstarWHILE[] = {3,9,13};
	Type::List::Line childStarWHILEOfOneSample(&mychildstarWHILE[0],&mychildstarWHILE[0]+3);
	std::cout<<std::endl<<"Setting Sample ends..."<<std::endl;

	//Type::List::Line childStarOfOneSample (mychildstar, mychildstar + sizeof(mychildstar)/sizeof(Type::Index::Line));
	Type::List::Line childStarWHILEOfOne = pkbR->getChildStar(1,Type::Entity::WHILE_LINE_ENTITY);
	std::sort(childStarWHILEOfOne.begin(),childStarWHILEOfOne.end());
	std::cout<<"childStarWHILEOfOne "<<std::endl;
	for(int k=0;k<childStarWHILEOfOne.size();k++){
			std::cout<<childStarWHILEOfOne.at(k)<<", ";
		}std::cout<<std::endl;
	std::cout<<"childStarWHILEOfOneSample "<<std::endl;
	for(int k=0;k<childStarWHILEOfOneSample.size();k++){
			std::cout<<childStarWHILEOfOneSample.at(k)<<", ";
		}std::cout<<std::endl;
	std::cout<<"Comparing ... "<<std::endl;
	CPPUNIT_ASSERT(childStarWHILEOfOne == childStarWHILEOfOneSample); //Match line 1 's WHILE Children and grandchildren

	//get ChildStar for statement One IF
	std::cout<<std::endl<<"Setting Sample ..."<<std::endl;
	Type::Index::Line mychildstarIF[] = {6,12,14};
	Type::List::Line childStarIFOfOneSample(&mychildstarIF[0],&mychildstarIF[0]+3);
	std::cout<<std::endl<<"Setting Sample ends..."<<std::endl;

	//Type::List::Line childStarOfOneSample (mychildstar, mychildstar + sizeof(mychildstar)/sizeof(Type::Index::Line));
	Type::List::Line childStarIFOfOne = pkbR->getChildStar(1,Type::Entity::IF_LINE_ENTITY);
	std::sort(childStarIFOfOne.begin(),childStarIFOfOne.end());
	std::cout<<"childStarIFOfOne "<<std::endl;
	for(int k=0;k<childStarIFOfOne.size();k++){
			std::cout<<childStarIFOfOne.at(k)<<", ";
		}std::cout<<std::endl;
	std::cout<<"childStarIFOfOneSample "<<std::endl;
	for(int k=0;k<childStarIFOfOneSample.size();k++){
			std::cout<<childStarIFOfOneSample.at(k)<<", ";
		}std::cout<<std::endl;
	std::cout<<"Comparing ... "<<std::endl;
	CPPUNIT_ASSERT(childStarIFOfOne == childStarIFOfOneSample); //Match line 1 's IF Children and grandchildren


	std::cout<<"Destroying ... "<<std::endl;
	pkbR->~PKB();
	std::cout<<"Destroyed ... "<<std::endl;
}

